debian/tests: Port to Gtk4 and run them both in wayland and x11
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 9 Jul 2021 04:06:36 +0000 (06:06 +0200)
committerMarco Trevisan (Treviño) <marco@ubuntu.com>
Fri, 9 Jul 2021 14:30:56 +0000 (16:30 +0200)
debian/tests/build
debian/tests/control
debian/tests/installed-tests
debian/tests/installed-tests-flaky
debian/tests/python3-gi

index c99c2e4d4176e57066f54ab864b3687ff2010d67..fdfb41d28eeef7080e1892d43f58f49ef32753ac 100755 (executable)
@@ -11,10 +11,7 @@ set -e
 set -u
 set -x
 
-# We don't test under Wayland yet, because we don't have a Wayland
-# equivalent of xvfb-run
-export GDK_BACKEND=x11
-
+TESTDIR="$PWD/$(dirname $0)"
 WORKDIR=$(mktemp -d)
 cleanup () {
     rm -fr "$WORKDIR"
@@ -72,6 +69,6 @@ EOF
 "${CROSS_COMPILE}gcc" -o gtktest gtktest.c $("${CROSS_COMPILE}pkg-config" --cflags --libs gtk4)
 echo "build: OK"
 [ -x gtktest ]
-xvfb-run -a -s "-screen 0 1024x768x24" \
+"$TESTDIR"/run-with-display $GDK_BACKEND \
 ./gtktest
 echo "run: OK"
index e535d20f4557a609e475dcdc207fe19b75da8333..649912e7b82c6800f4937cb5e53274c129afb7e6 100644 (file)
@@ -1,16 +1,51 @@
-Tests: build
+Test-Command: env GDK_BACKEND=x11 debian/tests/build
+Features: test-name=build-x11
+Classes: desktop, x11
 Depends: build-essential, libgtk-4-dev, xauth, xvfb
 Restrictions: allow-stderr, superficial
 
-Tests: python3-gi
+Test-Command: env GDK_BACKEND=wayland debian/tests/build
+Features: test-name=build-wayland
+Classes: desktop, wayland, linux-only
+Depends: build-essential, libgtk-4-dev, weston
+# Architecture: linux-any
+Restrictions: allow-stderr, superficial
+
+Test-Command: env GDK_BACKEND=x11 debian/tests/python3-gi
+Features: test-name=python3-gi-x11
+Classes: desktop, x11
 Depends: dbus, gir1.2-gtk-4.0, python3-gi (>= 3.40), xauth, xvfb
-# https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/81, !145, etc.
-Restrictions: flaky, superficial
+Restrictions: superficial
 
-Tests: installed-tests
+Test-Command: env GDK_BACKEND=wayland debian/tests/python3-gi
+Features: test-name=python3-gi-wayland
+Classes: desktop, wayland, linux-only
+Depends: dbus, gir1.2-gtk-4.0, libgl1, libgl1-mesa-dri, python3-gi (>= 3.40), weston
+# Architecture: linux-any
+Restrictions: superficial
+
+Test-Command: env GDK_BACKEND=x11 debian/tests/installed-tests
+Features: test-name=installed-tests-x11
+Classes: desktop, x11
 Depends: dbus (>= 1.8), fonts-dejavu-core, gnome-desktop-testing (>= 2018.1-1~), gtk-4-tests, locales | locales-all, ttf-bitstream-vera, xauth, xvfb
 Restrictions: allow-stderr
 
-Tests: installed-tests-flaky
+Test-Command: env GDK_BACKEND=wayland debian/tests/installed-tests
+Features: test-name=installed-tests-wayland
+Classes: desktop, wayland, linux-only
+Depends: dbus (>= 1.8), fonts-dejavu-core, gnome-desktop-testing (>= 2018.1-1~), gtk-4-tests, locales | locales-all, ttf-bitstream-vera, weston
+# Architecture: linux-any
+Restrictions: allow-stderr
+
+Test-Command: env GDK_BACKEND=x11 debian/tests/installed-tests-flaky
+Features: test-name=installed-tests-flaky-x11
+Classes: desktop, x11
 Depends: dbus (>= 1.8), fonts-dejavu-core, gnome-desktop-testing (>= 2018.1-1~), gtk-4-tests, locales | locales-all, ttf-bitstream-vera, xauth, xvfb
 Restrictions: allow-stderr, flaky
+
+Test-Command: env GDK_BACKEND=wayland debian/tests/installed-tests-flaky
+Features: test-name=installed-tests-flacky-wayland
+Classes: desktop, wayland, linux-only
+Depends: dbus (>= 1.8), fonts-dejavu-core, gnome-desktop-testing (>= 2018.1-1~), gtk-4-tests, locales | locales-all, ttf-bitstream-vera, weston
+# Architecture: linux-any
+Restrictions: allow-stderr, flaky
index fcffbf9d5efb73733126e8e5d615ec7a2aa22195..dac000d1338a5a69d2c098c50a2bdc0f705d6487 100755 (executable)
@@ -10,17 +10,14 @@ export GIO_USE_VFS=local
 export GIO_USE_VOLUME_MONITOR=unix
 
 export XDG_RUNTIME_DIR="$AUTOPKGTEST_TMP"
-
-# We don't test under Wayland yet, because we don't have a Wayland
-# equivalent of xvfb-run
-export GDK_BACKEND=x11
+export HOME="$AUTOPKGTEST_TMP"
 
 tests=$(gnome-desktop-testing-runner -l gtk-4.0 |
     cut -f1 -d' ' |
     grep -v '^gtk-4.0/gtk/templates.test$')
 
 exec dbus-run-session -- \
-xvfb-run -a -s "-screen 0 1024x768x24" \
+debian/tests/run-with-display $GDK_BACKEND \
 debian/tests/run-with-locales \
     --generate de_DE.UTF-8 \
     --generate en_GB.UTF-8 \
index f092c982ea62cefa272b2bc27af7165e0d765e9b..47b39cc17965607e1c78ed7f9baf29d8cb17a646 100755 (executable)
@@ -11,19 +11,14 @@ export GIO_USE_VOLUME_MONITOR=unix
 
 export XDG_RUNTIME_DIR="$AUTOPKGTEST_TMP"
 
-# We don't test under Wayland yet, because we don't have a Wayland
-# equivalent of xvfb-run
-export GDK_BACKEND=x11
-
 exec dbus-run-session -- \
-xvfb-run -a -s "-screen 0 1024x768x24" \
 debian/tests/run-with-locales \
     --generate de_DE.UTF-8 \
     --generate en_GB.UTF-8 \
     --generate en_US.UTF-8 \
     --generate sv_SE \
     -- \
-xvfb-run -a -s "-screen 0 1024x768x24" \
+debian/tests/run-with-display $GDK_BACKEND \
 gnome-desktop-testing-runner \
 --report-directory="$AUTOPKGTEST_ARTIFACTS" \
 --tap \
index 437346d6bab2feea2a8ca460e0ec42e896b42d17..2fc1ad8fc4eebe999206dfd0c2faab95ff3e8b03 100755 (executable)
@@ -1,22 +1,24 @@
 #!/bin/sh
 
-# We don't test under Wayland yet, because we don't have a Wayland
-# equivalent of xvfb-run
-export GDK_BACKEND=x11
-
-xvfb-run -a -s "-screen 0 1024x768x24" \
+debian/tests/run-with-display $GDK_BACKEND \
+dbus-run-session \
 python3 <<EOF
+import gi
+gi.require_version('Gtk', '4.0')
 from gi.repository import GLib, Gtk
 
+loop = GLib.MainLoop()
+
 def do_quit(user_data):
-    Gtk.main_quit()
+    window.destroy()
+    loop.quit()
     return GLib.SOURCE_REMOVE
 
-dialog = Gtk.Dialog()
-dialog.set_title('Test dialog')
-dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
-dialog.show_all()
+window = Gtk.Window()
+window.set_title('Test Window')
+window.show()
 GLib.timeout_add_seconds(1, do_quit, None)
-Gtk.main()
+
+loop.run()
 EOF